perf: parallelize jsDelivr README fallback probes#2384
perf: parallelize jsDelivr README fallback probes#2384ghostdevv merged 8 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR updates server/utils/readme-loaders.ts to fetch jsDelivr README candidates in concurrent batches of three (via Promise.all) using a new constant JSDELIVR_README_FETCH_BATCH_SIZE. fetchReadmeFromJsdelivr now returns the first non-empty response from each batch (fetch errors or non-OK responses map to null). A new helper buildReadmeFetchCandidates excludes a provided readmeFilename from standard candidates. resolvePackageReadmeSource is changed to try the explicit readmeFilename first and, if that yields null, fall back to fetching the batched candidate list. Tests were added/expanded to verify batching, selective response.text() invocation, and the new candidate ordering; exported function signatures remain unchanged. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Also updated PR to fetch provided readme before starting the fallback batch in 72bb0b2 |
36fced5 to
4e00761
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
server/utils/readme-loaders.ts (1)
115-125: Fix typoed inline commentsThere are a couple of typos (
unsucessful,sometihng) in the inline comments. Quick polish for readability.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 248c6759-6520-45f8-8aca-2e08376a991a
📒 Files selected for processing (2)
server/utils/readme-loaders.tstest/unit/server/utils/readme-loaders.spec.ts
✅ Files skipped from review due to trivial changes (1)
- test/unit/server/utils/readme-loaders.spec.ts
🔗 Linked issue
N/A
🧭 Context
README fallback probing in
server/utils/readme-loaders.tswas strictly sequential. On cache misses, packages with missing or nonstandard README filenames could pay for several failed jsDelivr requests before the loader found the right file or gave up, which made worst-case README render time noticeably slower than necessary.📚 Description
This changes the jsDelivr README fallback path to reduce that long-tail latency while keeping the fallback behavior conservative.
readmeFilenamefirst when it exists.test/unit/server/utils/readme-loaders.spec.ts.